package com.lagou.ipersistence.type;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @author Yan Jiahong
 * Created on 2020/11/24
 */
public class DateTypeHandler extends BaseTypeHandler<Date> {
    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, Date parameter, JdbcType jdbcType) throws SQLException {
        ps.setDate(i, new java.sql.Date(parameter.getTime()));
    }
    
    @Override
    public Date getNonNullResult(ResultSet rs, String columnName) throws SQLException {
        return rs.getDate(columnName);
    }
}
